<template>
  <view class="my-search-bank">
    <view
      ><u-search
        :show-action="true"
        actionText="搜索"
        v-model="keyword"
        placeholder="请输入支行名称"
        :animation="false"
        @custom="custom"
      ></u-search
    ></view>
    <view class="ul">
      <view
        class="li"
        v-for="(item, index) in list"
        :key="index"
        @click="clickFun(item)"
      >
        {{ item.bankName }}
      </view>
    </view>
  </view>
</template>

<script>
import {
  getStoreData,
  dealNum,
  setStoreData,
  httpPost,
  httpGet,
} from "@/utils/http.js";
const pic1 = require(`@/img/my/my1.png`);
export default {
  data() {
    return { keyword: "", list: [], parentNumber: "", cardObj: {} };
  },
  onLoad(options) {
    this.parentNumber = options.bankNumber;
    this.cardObj = getStoreData("cardObjNew");
  },
  methods: {
    custom() {
      const _this = this;
      httpPost(
        "/api/banklist/querySubBank",
        {
          bankName: this.keyword,
          parentNumber: this.parentNumber,
        },
        {
          isLoad: true,
          title: "加载中...",
        }
      )
        .then((res) => {
          _this.list = res.data;
        })
        .catch((e) => {});
    },

    clickFun(item) {
      this.$emit("updateData", item.bankName);
    },
  },
};
</script>

<style lang="scss">
.my-search-bank {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  background: #f8f8f8;
  width: 100vw;
  height: 100%;
  padding: 16px;
  .ul {
    margin-top: 24px;
    overflow-y: auto;
  }
  .li {
    line-height: 36px;
    color: #333;
    font-size: 14px;
    height: 36px;
  }
  .content {
    background: #fff;
    border-radius: 4px;
    padding: 0 16px;
    box-sizing: border-box;
    margin-bottom: 16px;
    width: calc(100vw - 32px);
    /deep/.u-cell__body {
      padding: 16px 0 !important;
    }
    /deep/.u-cell-group__wrapper {
      .u-line:first-child,
      .u-cell:last-child .u-line {
        display: none !important;
      }
    }
  }
  .u-slot-title1 {
    display: flex;
    flex-direction: column;
  }
  .my-top {
    display: flex;
    width: 100%;
    flex-direction: column;
    .ava {
      width: 40px;
      height: 40px;
      border-radius: 40px;
      overflow: hidden;
    }
  }

  .sub {
    margin: 48px 0;
    /deep/.u-button {
      width: 78vw;
      height: 50px;
      line-height: 50px;
      font-size: 16px;
    }
  }
}
</style>
